package com.google.common.primitives;

public final class UnsignedInts {
    static int flip(int value) {
        return Integer.MIN_VALUE ^ value;
    }

    public static int compare(int a, int b) {
        return Ints.compare(flip(a), flip(b));
    }

    public static long toLong(int value) {
        return ((long) value) & 4294967295L;
    }

    public static int divide(int dividend, int divisor) {
        return (int) (toLong(dividend) / toLong(divisor));
    }

    public static String toString(int x, int radix) {
        return Long.toString(((long) x) & 4294967295L, radix);
    }
}
